#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX_SIZE 12

char* concatenate_strings(char* a, size_t a_size, char* b)
{
    size_t len_a = strlen(a);
    if (len_a + strlen(b) > a_size - 1)
    {
        fprintf(stderr, "Error: Insufficient space to concatenate the strings.\n");
        return NULL;
    }

    for (size_t j = 0; b[j] != '\0'; j++, len_a++)
    {
        a[len_a] = b[j];
    }
    a[len_a] = '\0';
    return a;
}

int main()
{
    char x[MAX_SIZE] = {'H','e','l','l','o','\0'};
    char y[] = {'W','o','r','l','d','\0'};

    char* result = concatenate_strings(x, sizeof(x), y);
    if (result == NULL)
    {
        printf("An error occurred: Insufficient space.\n");
    }
    else
    {
        printf("%s\n", result);
    }

    return 0;
}